const express=require("express");
const expressStatic=require("express-static");
const bodyParser = require('body-parser');
//建立服务器
var server=express();
//监听端口
server.listen(8080);
var users={
  "zhangsan":"123456",
  "lisi":"123456",
  "wanglaoji":"123456",
  'huahua':"159357"
}
server.get("/register",function (req,res) {
  
  var user=req.query["user"];
  var pass=req.query["pass"];
  if (users[user]==null) {
    res.send({ok:true,msg:"注册成功"});
  }else{
          res.send({ok:false,msg:"注册失败"});
    }
});
server.get("/register2",function (req,res) {
  
  var user=req.query["user"];
  var pass=req.query["pass"];
  if (users[user]==null) {
    res.send({ok:true,msg:"登录成功"});
  }else{
          res.send({ok:false,msg:"登录失败"});
    }

  
});
server.use(expressStatic("./www"));